<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<link href="css/my.css" rel="stylesheet" />
		<style>
			.title {
				margin: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
			}
			.mui-page .mui-table-view:first-child {
			    margin-top: 15px;
			}
			.mui-table-view {
			    margin-top: 20px;
			}
			.update {
			    font-style: normal;
			    color: #999999;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav bc2">
			<h1 class="mui-title">搜书</h1>
		</header>
		<div class="mui-content bc">
			<ul class="mui-table-view bc2">
				<li class="mui-table-view-cell mui-media" style="line-height: 2;">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="images/icon3.png" style="min-width: 66px;height: 66px;">
						<div class="mui-media-body">
							关于搜书
							<p class="mui-ellipsis">致力于为喜欢阅读的朋友提供良好的阅读环境</p>
						</div>
					</a>
				</li>
			</ul>
			<ul class="mui-table-view bc2" style="line-height: 1.5;">
				<li class="mui-table-view-cell" id="tags">
					<a class="mui-navigate-right"><span class="mui-icon mui-icon-bars"></span> 阅读记录</a>
				</li>
			</ul>
			<ul class="mui-table-view bc2" style="line-height: 1.5;">
				<!-- <li class="mui-table-view-cell" id="fromType">
					<a class="mui-navigate-right"><span class="mui-icon mui-icon-settings"></span> 切换书源</a>
				</li> -->
				<li class="mui-table-view-cell" id="feedback">
					<a class="mui-navigate-right"><span class="mui-icon mui-icon-help"></span> 反馈建议</a>
				</li>
				<li class="mui-table-view-cell" id="mianze">
					<a class="mui-navigate-right"><span class="mui-icon mui-icon-info"></span> 免责声明</a>
				</li>
				<li class="mui-table-view-cell" id="share">
					<a class="mui-navigate-right"><span class="mui-icon mui-icon-redo"></span> 分享应用</a>
				</li>
				<li class="mui-table-view-cell">
					<span class="mui-icon mui-icon-info"></span> 
					当前版本
					<i class="mui-pull-right update" id="version"></i>
				</li>
			</ul>
		</div>

	</body>
	<script src="js/mui.min.js"></script>
	<script src="js/config.js"></script>
	<script src="js/date.js"></script>
	<script src="js/book.js"></script>
	<script>
		var self;
		var deviceNum;
		var bookId;
		var content;
		var url;
		var share;
		mui.init();
		mui.plusReady(function() {
			var version = plus.storage.getItem("version");
			document.getElementById("version").innerHTML = 'V' + version;
			
			mui.ajax(config.config.path + "/config/share", {
				type: "GET",
				dataType: "json",
				success: function(result) {
					var code = result.code;
					if (code == 200) {
						share = result.data.value;
						url = share.substring(share.indexOf("http"));
					}
				}
			});
		});
		
		document.getElementById("mianze").addEventListener('tap', function() {
			mui.openWindow({
				url: "mianze.html",
				show: {
					autoShow: true //页面loaded事件发生后自动显示，默认为true/页面动画持续时间，Android平台默认100毫秒，iOS平台默认200毫秒；
				},
				waiting: {
					autoShow: false, //自动显示等待框，默认为true
					title: '正在加载...' //等待对话框上显示的提示内容
				}
			});
		});
		
		document.getElementById("tags").addEventListener('tap', function() {
			mui.openWindow({
				url: "tags.html",
				id: "tags.html",
				extras: { //自定义扩展参数，可以用来处理页面间传值
		
				},
				createNew: false, //是否重复创建同样id的webview，默认为false:不重复创建，直接显示
				show: {
					autoShow: true //页面loaded事件发生后自动显示，默认为true/页面动画持续时间，Android平台默认100毫秒，iOS平台默认200毫秒；
				},
				waiting: {
					autoShow: false, //自动显示等待框，默认为true
					title: '正在加载...' //等待对话框上显示的提示内容
				}
			});
		});
		
		document.getElementById("feedback").addEventListener('tap', function() {
			mui.openWindow({
				url: "feedback.html",
				id: "feedback.html",
				extras: { //自定义扩展参数，可以用来处理页面间传值
					bookId: 0,
					content: ""
				},
				createNew: false, //是否重复创建同样id的webview，默认为false:不重复创建，直接显示
				show: {
					autoShow: true //页面loaded事件发生后自动显示，默认为true/页面动画持续时间，Android平台默认100毫秒，iOS平台默认200毫秒；
				},
				waiting: {
					autoShow: false, //自动显示等待框，默认为true
					title: '正在加载...' //等待对话框上显示的提示内容
				}
			});
		});
		
		document.getElementById("share").addEventListener('tap',function(){
			shareSystem(share);
		});
		
		/**
		 * 调用系统分享
		  */
		function shareSystem(value){
			var msg={content:value};
			if('iOS'==plus.os.name){//iOS平台添加链接地址
				msg.href=url;
			}
			console.log(JSON.stringify(msg));
			plus.share.sendWithSystem?plus.share.sendWithSystem(msg, function(){
				console.log('Success');
			}, function(e){
				console.log('Failed: '+JSON.stringify(e));
			}):shareSystemNativeJS();
		}
		function shareSystemNativeJS() {
			if(plus.os.name!=='Android'){
				plus.nativeUI.alert('此设备暂不支持分享功能!');
				return;
			}
			var intent=new Intent(Intent.ACTION_SEND);
		    intent.setType('text/plain');
			intent.putExtra(Intent.EXTRA_SUBJECT,'Soubook');
			intent.putExtra(Intent.EXTRA_TEXT,value);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			main.startActivity(Intent.createChooser(intent,'应用分享'));
		}
	</script>
</html>
